//成绩页面展示的处理函数
//导入数据库连接
const db = require('../db/index')

module.exports.grade = (req, res) => {
  const sqlStr = 'SELECT * from Student,Grade WHERE Student.id=Grade.id'
  db.query(sqlStr, (err, result) => {
    if (err) {
      return res.send({
        status: '1',
        message: '查询失败'
      })
    }
    if (result.length === 0) {
      return res.send({
        status: 400,
        message: '数据库为空'
      })
    }
    if (result.length > 0) {
      return res.send({
        status: 200,
        data: result
      })
    }
  })
}